<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微信授权测试</title>
</head>
<body>
<p>当前OPENID:<span id="text" style="color:red"></span></p>
</body>
<script type="text/javascript">
    /*--获取网页传递的参数--*/
    function request(paras) {
        var url = location.href;
        var paramStr = url.substring(url.indexOf('?') + 1, url.length).split('&');
        var j;
        var paramObj = {};
        for (var i = 0; j = paramStr[i]; i++) {
            paramObj[j.substring(0, j.indexOf('=')).toLowerCase()] = j.substring(j.indexOf('=') + 1, j.length);
        }

        var returnValue = paramObj[paras.toLowerCase()];

        if (typeof(returnValue) == "undefined") {
            return "";
        } else {
            return returnValue;
        }
    }

    window.onload = function() {
        document.getElementById("text").innerText=request("openid");
    }

</script>
</html>